TableSetDataExpiration

设置表数据淘汰

请求地址

POST
http://OmsAddress/app/newoms.php/webservice/business/table/set-data-expiration?cmd=10016&ip-type=webservicerest&access-token=AccessTokenVal

POST请求参数说明

参数名称 数据类型 说明 是否必填字段 备注
app_id 整型 设置数据淘汰的目标表的业务id
zone_id 整型 设置数据淘汰的目标表的游戏区id
table_name 字符串 设置数据淘汰的目标表的表名
rule_type 整型 数据淘汰级别,1:表级(默认值,之前只支持此模式) 2:记录级(新增的模式)
age 整型 单位秒,数据过期时间,建议大于450s,超过这个时间的数据会被系统自动删除掉,范围:[0,3153600000]
list_empty_index_age 整型(0或1) 单位秒,list表空索引过期时间,一般设置为0,超过这个时间的空索引会被系统自动删除掉,单位秒,范围:[0,3153600000]

Data参数

使用json格式表示记录相关信息,示例如下:

{
    "app_id": 2,
    "zone_id": 3,
    "table_name": "table_list_1",
    "age": 460,
    "list_empty_index_age": 0
}

返回语法

返回参数说明

  1. 返回状态码不为200时,表示审核失败,返回数据为执行事务失败的信息

  2. 返回状态码为200,表示事务成功,返回的数据结构如下:

参数名称 数据类型 说明 备注
set_id 整型 设置表数据淘汰事务的所在集群id
trans_id 整型 设置表数据淘汰事务的事务id

​使用以上返回信息,可查询表数据淘汰是否完成。

请求示例

通过 curl 方法发起请求

命令中的参数请参考本页中的“POST请求参数说明”,access-token的获取方法详见:获取access-token

curl -H "Content-type: application/json" -X "POST" -d '{
    "app_id": 2,
    "zone_id": 3,
    "table_name": "table_list_1",
    "age": 460,
    "list_empty_index_age": 0
}' http://omsaddress/app/newoms.php/webservice/business/table/set-data-expiration?cmd=10016&ip-type=webservicerest&access-token=<access-token>

返回示例

成功返回示例

http请求的Status=200

{
    "set_id": 126,
    "trans_id": 535,
    "user": "yunwei"
}

错误返回

http请求的Status!=200

{
    "name": "Unauthorized",
    "message": "You are requesting with an invalid credential.",
    "code": 0,
    "status": 401,
    "type": "yii\\web UnauthorizedHttpException"
}
{
    "table_list_1": [
        "can't find table (app_id:2,zone_id;3,table_name:table_list_1)"
    ]
}

results matching ""

    No results matching ""